gusucode.com > 耐品图片管理系统 标准版A > 耐品图片管理系统 标准版A/Admin_Export.asp
<!--#include file="Admin_ChkPurview.asp"--> <% '=============================================================== ' 著作权号:中国国家版权局著作权登记号2004SR07385 ' 版权所有:深圳市耐品科技开发有限公司 www.naipin.com ' 联系电话:0755-26611119 81234844 81234845 ' 联系手机:13316911914 ' 联系邮箱:naipin@naipin.com '=============================================================== Dim Rs,Dbname,fso,templateConn,templateRs Dbname = Trim(Request("Dbname"))&"" If Dbname<>"" Then Dbname = Server.MapPath(Dbname) Set fso = Server.CreateObject("Scripting.FileSystemObject") If Not fso.FileExists(Dbname) Then Behind.WriteErrMsg "<br><li>输入的模板数据库文件不存在!</li>" Response.End() End If Set fso = Nothing End If Set Rs = Server.CreateObject("adodb.recordset") Action = Request.queryString("Action") Select Case Action Case "Input" Set templateConn = Server.CreateObject("adodb.connection") templateConn.Open "Provider=Microsoft.Jet.Oledb.4.0;Data Source="&Dbname Set templateRs = Server.CreateObject("adodb.recordset") templateRs.Open "Nt_Style",templateConn,1,1 On Error Resume Next Do While Not templateRs.Eof Rs.Open "Select Top 1 * From Nt_Style Where Id Is Null",Conn,1,3 Rs.AddNew Rs("ID") = Conn.Execute("Select Max(Id) From Nt_Style")(0)+1 Rs("TempName") = templateRs("TempName") Rs("MainPage") = templateRs("MainPage") Rs("PageComm") = templateRs("PageComm") Rs("PageImage") = templateRs("PageImage") Rs("CommHtml") = templateRs("CommHtml") Rs("InfoCode") = templateRs("InfoCode") Rs("PageEdit") = templateRs("PageEdit") Rs("PageIndex") = templateRs("PageIndex") Rs("StyleCss") = templateRs("StyleCss") Rs("Readme") = templateRs("Readme") Rs("IsDefault") = 0 Rs.Update Rs.Close templateRs.MoveNext Loop If Err Then Behind.WriteErrMsg "<br><li>数据库结构不一致!</li>" Else Behind.WriteSuccessMsg templateRs.RecordCount&" 个模板导入成功","Admin_Template.asp" End If templateRs.Close Set templateRs = Nothing templateConn.Close Set templateConn = Nothing Case "Output" StyleId = Trim(Request.Form("StyleId"))&"" If StyleId<>"" Then Set templateConn = Server.CreateObject("adodb.connection") templateConn.Open "Provider=Microsoft.Jet.Oledb.4.0;Data Source="&Dbname Set templateRs = Server.CreateObject("adodb.recordset") templateRs.Open "Nt_Style",templateConn,1,3 On Error Resume Next Rs.Open "Select * From Nt_Style Where Id In("&StyleId&")",Conn,1,1 Do While Not Rs.Eof templateRs.AddNew templateRs("Id") = templateConn.Execute("Select Max(Id) From Nt_Style")(0)+1 templateRs("TempName") = Rs("TempName") templateRs("MainPage") = Rs("MainPage") templateRs("PageComm") = Rs("PageComm") templateRs("PageImage") = Rs("PageImage") templateRs("CommHtml") = Rs("CommHtml") templateRs("InfoCode") = Rs("InfoCode") templateRs("PageEdit") = Rs("PageEdit") templateRs("PageIndex") = Rs("PageIndex") templateRs("StyleCss") = Rs("StyleCss") templateRs("Readme") = Server.HtmlEncode(Request.Form("Readme"&Rs("ID"))) templateRs("IsDefault") = 0 templateRs.Update Rs.MoveNext Loop If Err Then Behind.WriteErrMsg "<br><li>数据库结构不一致!</li>" Else Behind.WriteSuccessMsg Rs.RecordCount&" 个模板导出成功","Admin_Template.asp" End If Rs.Close templateRs.Close Set templateRs = Nothing templateConn.Close Set templateConn = Nothing Else Behind.WriteErrMsg "<br><li>请选择要导出的模板!</li>" End If Case Else %> <html> <head> <title>摄影器材管理</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <script language="javascript"> function InputTemplate(){ if(form1.Dbname1.value!=""){ if(confirm("确定要从数据库 "+form1.Dbname1.value+" 导入模板数据吗?")){ location.href = "?Action=Input&Dbname="+form1.Dbname1.value; return true; }else return false; }else{ alert("请填写源数据库文件名!"); form1.Dbname1.focus(); return false; } } function OutputTemplate(){ if(form1.Dbname.value!="") return confirm("确实要导出模板到数据库 "+form1.Dbname.value+" 吗?"); else{ alert("请填写目标数据库文件名!"); form1.Dbname.focus(); return false; } } function Checked(obj){ var style; for (var i=0;i<form1.elements.length;i++){ style = form1.elements[i]; if(style.type&&(style.type=="checkbox")&&(style.id=="StyleId")) style.checked = obj.checked; } } </script> <% Behind.WriteHtmlHead templateLink = "<a href='Admin_Template.asp' class='black'>模板列表</a>" Behind.WriteHtmlTop "网站模板总管理",templateLink %> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" Class="border"> <form name="form1" method="post" action="?Action=Output"> <tr class="tdbg1"> <td colspan="3" align="center" class="tdbg1"><b>导入模板</b></td> </tr> <tr class="tdbg"> <td colspan="3">模板数据库文件名: <input name="Dbname1" type="text" id="Dbname1" value="Face/Nt_Skin.mdb"> <input type="button" value="确定" onClick="return InputTemplate();"> </td> </tr> <tr class="tdbg1"> <td colspan="3" align="center" class="tdbg1"><b>导出模板</b></td> </tr> <tr class="tdbg"> <td colspan="3" bgcolor="#FFFFFF"> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" Class="border"> <tr class="tdbg1"> <td width="4%" align="center" class="tdbg1">选择</td> <td width="26%" align="center" class="tdbg1">模板名称</td> <td width="70%" class="tdbg1">模板说明</td> </tr> <% Rs.Open "Select Id,TempName,Readme From Nt_Style Where TempName<>'系统备份模板'",Conn,1,1 Do while Not Rs.Eof %> <tr class="tdbg"> <td align="center"> <input type="checkbox" name="StyleId" id="StyleId" value="<%=Rs(0)%>"></td> <td><%=Rs(1)%></td> <td> <input name="Readme<%=Rs(0)%>" type="text" id="Readme<%=Rs(0)%>" size="40" maxlength="200" value="<%=Rs(2)%>"> </td> </tr> <% Rs.MoveNext Loop Rs.Close %> <tr class="tdbg"> <td align="center"> <input type="checkbox" name="checkbox" id="checkbox" onClick="javascript:Checked(this);"> </td> <td colspan="2">导出到目标数据库: <input name="Dbname" type="text" id="Dbname2" value="Face/Nt_Skin.mdb"> <input name="submit" type="submit" onClick="return OutputTemplate();" value="确定"> </td> </tr> </table> </td> </tr> </form> </table> <% Behind.WriteHtmlEnd End Select Set Rs = Nothing Set Config = Nothing Set Netout = Nothing %>